<?php

namespace App\Models;

class EwMember extends BaseModel
{

    /**
     *
     * @var integer
     * @Primary
     * @Column(type="integer", length=11, nullable=false)
     */
    public $id;

    /**
     *
     * @var string
     * @Column(type="string", length=60, nullable=true)
     */
    public $nickname;

    /**
     *
     * @var string
     * @Column(type="string", length=150, nullable=true)
     */
    public $bg_image;

    /**
     *
     * @var string
     * @Column(type="string", length=150, nullable=true)
     */
    public $avatar;

    /**
     *
     * @var integer
     * @Column(type="integer", length=1, nullable=true)
     */
    public $sex;

    /**
     *
     * @var string
     * @Column(type="string", length=60, nullable=true)
     */
    public $sign;

    /**
     *
     * @var string
     * @Column(type="string", length=60, nullable=true)
     */
    public $address;

    /**
     *
     * @var integer
     * @Column(type="integer", length=1, nullable=true)
     */
    public $auth_state;

    /**
     *
     * @var integer
     * @Column(type="integer", length=1, nullable=true)
     */
    public $state;

    /**
     *
     * @var integer
     * @Column(type="integer", length=1, nullable=true)
     */
    public $is_del;

    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        parent::initialize();
        $this->hasMany('id', 'App\Models\EwMemberAuth', 'id', ['alias' => 'EwMemberAuth']);
        $this->hasMany('id', 'App\Models\EwMemberSubs', 'member_id', ['alias' => 'EwMemberSubs']);
        $this->belongsTo('id', 'App\Models\\EwUser', 'id', ['alias' => 'EwUser']);
    }

    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'ew_member';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return EwMember[]|EwMember
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return EwMember
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

}
